package trlygjj.tanruiliyigenjinjin.query;

import com.alibaba.druid.util.StringUtils;
import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;
import trlygjj.tanruiliyigenjinjin.util.DateUtil;
import trlygjj.tanruiliyigenjinjin.util.StringUtil;

import java.util.Date;
@Setter
@Getter
public class EmployeeQueryObject extends QueryObject{

    private String sort;   //排序的列
    private String order;  //排序的方式
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date beginDate;
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date endDate;

    private String queryname;
    private String position;
    private String hiretype;
    private String keyword;
    private Long departmentId;

    public String getSort(){
        return StringUtils.isEmpty(sort) ? null : sort;
    }
    public String getOrder(){
        return StringUtils.isEmpty(order) ? "" : order;
    }

    public String getKeyword() {
        return StringUtil.hasLength(keyword) ? keyword : null;
    }
    public String getQueryname() {
        return StringUtil.hasLength(queryname) ? queryname : null;
    }
    public String getHiretype() {
        return StringUtil.hasLength(hiretype) ? hiretype : null;
    }
    public String getPosition() {
        return StringUtil.hasLength(position) ? position : null;
    }
    public Date getEndDate(){
        if(endDate != null){
            return DateUtil.getEndDate(endDate);
        }
        return endDate;
    }
}
